﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using proRFID_DiemDanh.Chung;
using System.Data;
using System.Data.SqlClient;

namespace proRFID_DiemDanh.DiemDanh
{
    public class mdDiemDanh
    {
        public static string ngayhoc;
        public static int magv;
        public static int buoi;
        public static int monhoc;
        public static int phong;
        public static int lop;        

        public static DataTable DiemDanh_GiaoViencbo(int MaGV)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_DiemDanh_GiaoViencbo", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@MaGV", MaGV);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable DiemDanh_moncbo(int Mamon)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_DiemDanh_moncbo", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@MaMH", Mamon);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable DiemDanh_phongcbo(int MaPH)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_DiemDanh_phongcbo", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@MaPH", MaPH);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable DiemDanh_lopcbo(int MaLOP)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_DiemDanh_lopcbo", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@MaLOP", MaLOP);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable DiemDanh_Buoicbo(int Buoi)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_DiemDanh_Buoicbo", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@Buoi", Buoi);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        
        public static DataTable DiemDanh_Select(string ngaygio,int buoihoc,int magv,int mamh,int maphong,int malop)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_DiemDanh_Select", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@ngaygio",ngaygio);
            da.SelectCommand.Parameters.AddWithValue("@buoihoc",buoihoc);
            da.SelectCommand.Parameters.AddWithValue("@magv",magv);
            da.SelectCommand.Parameters.AddWithValue("@mamh", mamh);
            da.SelectCommand.Parameters.AddWithValue("@maphong",maphong);
            da.SelectCommand.Parameters.AddWithValue("@malop",malop);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable DiemDanh_chitietquetthe(string masv,string ngaygio)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_DiemDanh_chitietquetthe ", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@masv", masv);
            da.SelectCommand.Parameters.AddWithValue("@ngaygio",ngaygio);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
    }
}